import { createRouter, createWebHistory } from "vue-router";
import Home from "../components/Home.vue";
import Welcome from "../components/Welcome.vue";
import Login from "../components/Login.vue";
import Category from "../components/goods/Category.vue";
import GoodsList from "../components/goods/GoodsList.vue";
import OrderList from "../components/order/OrderList.vue";
import CreateOrder from "../components/order/CreateOrder.vue";
import Backusers from "../components/user/Backusers.vue";
import Frontusers from "../components/user/Frontusers.vue";
import Role from "../components/user/Role.vue";

const routes = [
  { path: "/", redirect: "/login" },
  { path: "/login", component: Login },
  {
    path: "/home",
    component: Home,
    redirect: "/welcome",
    children: [
      {
        path: "/welcome",
        component: Welcome
      },
      {
        path: "/backusers",
        component: Backusers
      },
      {
        path: "/frontusers",
        component: Frontusers
      },
      {
        path: "/roles",
        component: Role
      },
      {
        path: "/categorys",
        component: Category
      },
      {
        path: "/goods",
        component: GoodsList
      },
      {
        path: "/createorder",
        component: CreateOrder
      },
      {
        path: "/orders",
        component: OrderList
      }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;
